import { createStore } from 'vuex'

export default createStore({
  state: {
    httpRequestList: []
  },
  mutations: {
    addHttpRequestList(state, payload) {
      if (payload == 0) {
        state.httpRequestList.forEach(item => item('suspend'))// 添加标识，中断请求
        state.httpRequestList = []
      } else {
        state.httpRequestList.push(payload)
      }
    }
  },
  actions: {
    // 移除请求
    async removeHttpRequestList(ctx) {
      ctx.commit('addHttpRequestList', 0)
    }
  },
  modules: {
  }
})
